/*     */ package my.rummyInterface;
/*     */ 
/*     */ import java.awt.Color;
/*     */ import java.awt.Dimension;
/*     */ import java.awt.Font;
/*     */ import java.awt.GridLayout;
/*     */ import java.awt.event.ActionEvent;
/*     */ import java.awt.event.ActionListener;
/*     */ import java.awt.event.MouseAdapter;
/*     */ import java.awt.event.MouseEvent;
/*     */ import javax.swing.BorderFactory;
/*     */ import javax.swing.JLabel;
/*     */ import javax.swing.JPanel;
/*     */ import javax.swing.JTextField;
/*     */ import javax.swing.border.TitledBorder;
/*     */ 
/*     */ public class PanelJugador extends JPanel
/*     */   implements ActionListener
/*     */ {
	/*     */   private static final long serialVersionUID = 1L;
	/*  31 */   public static String TEXTO_NUEVO = "TEXTO_NUEVO";
	/*     */   private RummyInterface principal;
	/*     */   private JTextField txtMano6;
	/*     */   private JTextField txtMano7;
	/*     */   private JTextField txtMano8;
	/*     */   private JTextField txtMano9;
	/*     */   private JTextField txtMano10;
	/*     */   private JTextField txtMano11;
	/*     */   private JTextField txtMano12;
	/*     */   private JTextField txtMano13;
	/*     */   private JTextField txtMano14;
	/*     */   private JTextField txtMano15;
	/*     */   private JTextField txtMano16;
	/*     */   private JTextField txtTotal;
	/*     */   private JTextField txtNombre;
	/*     */   private JTextField txtPosicion;
	/*     */   private boolean enter;
	/*     */ 
	/*     */   public PanelJugador(RummyInterface principalP, String nombre)
	/*     */   {
		/*  59 */     this.principal = principalP;
		/*     */     enter = false;
		/*     */ 
		/*  62 */     TitledBorder borde = BorderFactory.createTitledBorder(nombre);
		/*  63 */     borde.setTitleColor(Color.BLUE);
		/*  64 */     borde.setTitleFont(new Font("Arial", 1, 14));
		/*  65 */     borde.setBorder(BorderFactory.createEmptyBorder());
		/*  66 */     setBorder(borde);
		/*     */ 
		/*  69 */     setLayout(new GridLayout(15, 1));
		/*     */ 
		/*  72 */     setMaximumSize(new Dimension(150, 0));
		/*     */ 
		/*  75 */     this.txtMano6 = new JTextField("0");
		/*  76 */     this.txtMano6.setBackground(Color.WHITE);
		/*  77 */     this.txtMano6.addActionListener(this);
		/*  78 */     this.txtMano6.setActionCommand(TEXTO_NUEVO);
		/*  79 */     this.txtMano6.setHorizontalAlignment(0);
		/*  80 */     this.txtMano6.addMouseListener(new MouseAdapter()
		/*     */     {
			/*     */       public void mouseClicked(MouseEvent evt) {
				/*  83 */         PanelJugador.this.click(evt);
			/*     */       }
			/*     */ 
			/*     */       public void mouseExited(MouseEvent evt) {
				/*  87 */         PanelJugador.this.exit(evt);
			/*     */       }
		/*     */     });
		/*  91 */     this.txtMano7 = new JTextField("0");
		/*  92 */     this.txtMano7.setBackground(Color.lightGray);
		/*  93 */     this.txtMano7.addActionListener(this);
		/*  94 */     this.txtMano7.setActionCommand(TEXTO_NUEVO);
		/*  95 */     this.txtMano7.setHorizontalAlignment(0);
		/*  96 */     this.txtMano7.addMouseListener(new MouseAdapter()
		/*     */     {
			/*     */       public void mouseClicked(MouseEvent evt) {
				/*  99 */         PanelJugador.this.click(evt);
			/*     */       }
			/*     */ 
			/*     */       public void mouseExited(MouseEvent evt) {
				/* 103 */         PanelJugador.this.exit(evt);
			/*     */       }
		/*     */     });
		/* 107 */     this.txtMano8 = new JTextField("0");
		/* 108 */     this.txtMano8.setBackground(Color.lightGray);
		/* 109 */     this.txtMano8.addActionListener(this);
		/* 110 */     this.txtMano8.setActionCommand(TEXTO_NUEVO);
		/* 111 */     this.txtMano8.setHorizontalAlignment(0);
		/* 112 */     this.txtMano8.addMouseListener(new MouseAdapter()
		/*     */     {
			/*     */       public void mouseClicked(MouseEvent evt) {
				/* 115 */         PanelJugador.this.click(evt);
			/*     */       }
			/*     */ 
			/*     */       public void mouseExited(MouseEvent evt) {
				/* 119 */         PanelJugador.this.exit(evt);
			/*     */       }
		/*     */     });
		/* 123 */     this.txtMano9 = new JTextField("0");
		/* 124 */     this.txtMano9.setBackground(Color.lightGray);
		/* 125 */     this.txtMano9.addActionListener(this);
		/* 126 */     this.txtMano9.setActionCommand(TEXTO_NUEVO);
		/* 127 */     this.txtMano9.setHorizontalAlignment(0);
		/* 128 */     this.txtMano9.addMouseListener(new MouseAdapter()
		/*     */     {
			/*     */       public void mouseClicked(MouseEvent evt) {
				/* 131 */         PanelJugador.this.click(evt);
			/*     */       }
			/*     */ 
			/*     */       public void mouseExited(MouseEvent evt) {
				/* 135 */         PanelJugador.this.exit(evt);
			/*     */       }
		/*     */     });
		/* 139 */     this.txtMano10 = new JTextField("0");
		/* 140 */     this.txtMano10.setBackground(Color.lightGray);
		/* 141 */     this.txtMano10.addActionListener(this);
		/* 142 */     this.txtMano10.setActionCommand(TEXTO_NUEVO);
		/* 143 */     this.txtMano10.setHorizontalAlignment(0);
		/* 144 */     this.txtMano10.addMouseListener(new MouseAdapter()
		/*     */     {
			/*     */       public void mouseClicked(MouseEvent evt) {
				/* 147 */         PanelJugador.this.click(evt);
			/*     */       }
			/*     */ 
			/*     */       public void mouseExited(MouseEvent evt) {
				/* 151 */         PanelJugador.this.exit(evt);
			/*     */       }
		/*     */     });
		/* 155 */     this.txtMano11 = new JTextField("0");
		/* 156 */     this.txtMano11.setBackground(Color.lightGray);
		/* 157 */     this.txtMano11.addActionListener(this);
		/* 158 */     this.txtMano11.setActionCommand(TEXTO_NUEVO);
		/* 159 */     this.txtMano11.setHorizontalAlignment(0);
		/* 160 */     this.txtMano11.addMouseListener(new MouseAdapter()
		/*     */     {
			/*     */       public void mouseClicked(MouseEvent evt) {
				/* 163 */         PanelJugador.this.click(evt);
			/*     */       }
			/*     */ 
			/*     */       public void mouseExited(MouseEvent evt) {
				/* 167 */         PanelJugador.this.exit(evt);
			/*     */       }
		/*     */     });
		/* 171 */     this.txtMano12 = new JTextField("0");
		/* 172 */     this.txtMano12.setBackground(Color.lightGray);
		/* 173 */     this.txtMano12.addActionListener(this);
		/* 174 */     this.txtMano12.setActionCommand(TEXTO_NUEVO);
		/* 175 */     this.txtMano12.setHorizontalAlignment(0);
		/* 176 */     this.txtMano12.addMouseListener(new MouseAdapter()
		/*     */     {
			/*     */       public void mouseClicked(MouseEvent evt) {
				/* 179 */         PanelJugador.this.click(evt);
			/*     */       }
			/*     */ 
			/*     */       public void mouseExited(MouseEvent evt) {
				/* 183 */         PanelJugador.this.exit(evt);
			/*     */       }
		/*     */     });
		/* 187 */     this.txtMano13 = new JTextField("0");
		/* 188 */     this.txtMano13.setBackground(Color.lightGray);
		/* 189 */     this.txtMano13.addActionListener(this);
		/* 190 */     this.txtMano13.setActionCommand(TEXTO_NUEVO);
		/* 191 */     this.txtMano13.setHorizontalAlignment(0);
		/* 192 */     this.txtMano13.addMouseListener(new MouseAdapter()
		/*     */     {
			/*     */       public void mouseClicked(MouseEvent evt) {
				/* 195 */         PanelJugador.this.click(evt);
			/*     */       }
			/*     */ 
			/*     */       public void mouseExited(MouseEvent evt) {
				/* 199 */         PanelJugador.this.exit(evt);
			/*     */       }
		/*     */     });
		/* 203 */     this.txtMano14 = new JTextField("0");
		/* 204 */     this.txtMano14.setBackground(Color.lightGray);
		/* 205 */     this.txtMano14.addActionListener(this);
		/* 206 */     this.txtMano14.setActionCommand(TEXTO_NUEVO);
		/* 207 */     this.txtMano14.setHorizontalAlignment(0);
		/* 208 */     this.txtMano14.addMouseListener(new MouseAdapter()
		/*     */     {
			/*     */       public void mouseClicked(MouseEvent evt) {
				/* 211 */         PanelJugador.this.click(evt);
			/*     */       }
			/*     */ 
			/*     */       public void mouseExited(MouseEvent evt) {
				/* 215 */         PanelJugador.this.exit(evt);
			/*     */       }
		/*     */     });
		/* 219 */     this.txtMano15 = new JTextField("0");
		/* 220 */     this.txtMano15.setBackground(Color.lightGray);
		/* 221 */     this.txtMano15.addActionListener(this);
		/* 222 */     this.txtMano15.setActionCommand(TEXTO_NUEVO);
		/* 223 */     this.txtMano15.setHorizontalAlignment(0);
		/* 224 */     this.txtMano15.addMouseListener(new MouseAdapter()
		/*     */     {
			/*     */       public void mouseClicked(MouseEvent evt) {
				/* 227 */         PanelJugador.this.click(evt);
			/*     */       }
			/*     */ 
			/*     */       public void mouseExited(MouseEvent evt) {
				/* 231 */         PanelJugador.this.exit(evt);
			/*     */       }
		/*     */     });
		/* 235 */     this.txtMano16 = new JTextField("0");
		/* 236 */     this.txtMano16.setBackground(Color.lightGray);
		/* 237 */     this.txtMano16.addActionListener(this);
		/* 238 */     this.txtMano16.setActionCommand(TEXTO_NUEVO);
		/* 239 */     this.txtMano16.setHorizontalAlignment(0);
		/* 240 */     this.txtMano16.addMouseListener(new MouseAdapter()
		/*     */     {
			/*     */       public void mouseClicked(MouseEvent evt) {
				/* 243 */         PanelJugador.this.click(evt);
			/*     */       }
			/*     */ 
			/*     */       public void mouseExited(MouseEvent evt) {
				/* 247 */         PanelJugador.this.exit(evt);
			/*     */       }
		/*     */     });
		/* 251 */     this.txtTotal = new JTextField("0");
		/* 252 */     this.txtTotal.setEditable(false);
		/* 253 */     this.txtTotal.setBackground(Color.white);
		/* 254 */     this.txtTotal.setBorder(BorderFactory.createLineBorder(Color.BLACK, 2));
		/* 255 */     this.txtTotal.setHorizontalAlignment(0);
		/*     */ 
		/* 257 */     this.txtNombre = new JTextField("");
		/* 258 */     this.txtNombre.setVisible(false);
		/*     */ 
		/* 260 */     this.txtPosicion = new JTextField("");
		/* 261 */     this.txtPosicion.setEditable(false);
		/* 262 */     this.txtPosicion.setBackground(Color.white);
		/* 263 */     this.txtPosicion.setBorder(BorderFactory.createLineBorder(Color.BLACK, 2));
		/* 264 */     this.txtPosicion.setHorizontalAlignment(0);
		/* 265 */     this.txtPosicion.setSize(0, 40);
		/*     */ 
		/* 268 */     add(this.txtMano6);
		/* 269 */     add(this.txtMano7);
		/* 270 */     add(this.txtMano8);
		/* 271 */     add(this.txtMano9);
		/* 272 */     add(this.txtMano10);
		/* 273 */     add(this.txtMano11);
		/* 274 */     add(this.txtMano12);
		/* 275 */     add(this.txtMano13);
		/* 276 */     add(this.txtMano14);
		/* 277 */     add(this.txtMano15);
		/* 278 */     add(this.txtMano16);
		/* 279 */     add(this.txtTotal);
		/* 280 */     add(this.txtNombre);
		/* 281 */     add(this.txtPosicion);
		/*     */ 
		/* 283 */     JLabel label = new JLabel();
		/* 284 */     add(label);
		/*     */ 
		/* 286 */     setFont(new Font("Arial", 0, 25));
	/*     */   }
	/*     */ 
	/*     */   public void actionPerformed(ActionEvent e)
	/*     */   {
		/* 293 */     String comando = e.getActionCommand();
		/* 294 */     JTextField mano = (JTextField)e.getSource();
		/* 295 */     if (comando.equals(TEXTO_NUEVO))
		/*     */     {
			/* 297 */       this.principal.definirPuntaje(mano);
			/* 298 */       this.principal.definirPosiciones();
			/* 299 */       this.principal.backGround();
			/*     */       this.enter = true;
		/*     */     }
	/*     */   }
	/*     */ 
	/*     */   public void click(MouseEvent evt)
	/*     */   {
		/* 305 */     JTextField texto = (JTextField)evt.getSource();
		/* 306 */     if (texto.getText().equals("0"))
		/*     */     {
			/* 308 */       texto.setText("");
		/*     */     }
	/*     */   }
	/*     */ 
	/*     */   private void exit(MouseEvent evt)
	/*     */   {
		/* 314 */     JTextField jtextfield = (JTextField)evt.getSource();
		/* 315 */     if (jtextfield.getText().equals(""))
		/*     */     {
			/* 317 */       jtextfield.setText("0");
		/*     */     }
		/*     */     if(!enter)
		/*     */     {
			/* 319 */     this.principal.definirPuntaje(jtextfield);
			/* 320 */     this.principal.definirPosiciones();
			/* 321 */     this.principal.backGround();
		/*     */     }
		/*     */     else
			/*     */     enter = false;
	/*     */   }
/*     */ }

/* Location:           C:\Users\Yank\Documents\APO\Rummy\bin\
 * Qualified Name:     my.rummyInterface.PanelJugador
 * JD-Core Version:    0.6.0
 */